package com.testshiro.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.base.service.BaseServiceImpl;
import com.testshiro.dao.SysAccountDao;
import com.testshiro.entity.SysAccount;
import com.testshiro.entity.SysAutho;
import com.testshiro.entity.SysRole;
import com.testshiro.service.SysAccountService;

/**
 * 
 * <br>
 * <b>功能：</b>SysAccountService<br>
 */
@Service("sysaccountService")
public class  SysAccountServiceImpl  extends BaseServiceImpl implements SysAccountService {
  private final static Logger log= Logger.getLogger(SysAccountServiceImpl.class);
	

	@Resource
    private SysAccountDao sysAccountDao;

		
	public SysAccountDao getDao() {
		return sysAccountDao;
	}

	@Override
	public List<SysAutho> getMenuTree(Long seqId,Long parentId) {
		Map<String, Object> condition = new HashMap<String, Object>();
		condition.put("seqId", seqId);
		condition.put("parentId", parentId);
		return sysAccountDao.getMenuTree(condition);
	}

	@Override
	public List<SysRole> getUserRoles(Long accountId) {
		return sysAccountDao.getUserRoles(accountId);
	}

	@Override
	public List<SysAccount> login(String loginName, String password) {
		Map<String, Object> condition = new HashMap<String, Object>();
		condition.put("loginName", loginName);
		condition.put("password", password);
		return sysAccountDao.login(condition);
	}

	@Override
	public List<SysAutho> getAuthosByUserName(String username) {
		return sysAccountDao.getAuthosByUserName(username);
	}

}
